package com.jd.nbd.strategy05;

/**
 * Created by liyue on 2017/8/24
 */
public class RuleFactory {
  public static Rule[] getRules(int level) {

    CheckNameIsEmptyRule checkNameIsEmptyRule = new CheckNameIsEmptyRule();
    CheckGenderRule checkGenderRule = new CheckGenderRule();
    CheckNameRule checkNameRule = new CheckNameRule();
    CheckAgeRule checkAgeRule = new CheckAgeRule();
    CheckHealthRule checkHealthRule = new CheckHealthRule();

    Rule[][] ruleArray = {
        {checkNameIsEmptyRule, checkGenderRule, checkAgeRule, checkHealthRule},//小孩子
        {checkNameIsEmptyRule, checkGenderRule, checkNameRule},//青少年
        {checkNameIsEmptyRule, checkNameRule},//成年
        {checkNameIsEmptyRule, checkGenderRule, checkAgeRule, checkHealthRule},//老年
    };

    return ruleArray[level];
  }
}
